<?php
function date_picker($name, $startyear=NULL, $endyear=NULL)
{
	if($startyear==NULL) $startyear = date("Y")-100;
	if($endyear==NULL) $endyear=date("Y")+50;

	$months=array('','January','February','March','April','May',
			'June','July','August', 'September','October','November','December');

	$html = "<select name=\"".$name."day\">";
	for($i = 1; $i <= 31; $i++)
	{
		$html.="<option value='$i'>$i</option>";
	}
	$html.="</select> ";

	$html .= "<select name=\"".$name."month\">";
	for($i = 1; $i <= 12; $i++)
	{
		$html.="<option value='$i'>$months[$i]</option>";
	}
	$html.="</select> ";

	$html.="<select name=\"".$name."year\">";
	for($i = $endyear ; $i >= $startyear; $i--)
	{
	$html.="<option value='$i'>$i</option>";
	}
	$html.="</select> ";

    return $html;
}


function manageDate($strDate) {
	$birthDate = $_POST[$strDate.'year']."-";
	if($_POST[$strDate.'month'] < 10) {
		$birthDate.= "0".$_POST[$strDate.'month'];
	}
	else $birthDate.= $_POST[$strDate.'month'];
	$birthDate.= "-";
	if($_POST[$strDate.'day'] < 10) {
		$birthDate.= "0".$_POST[$strDate.'day'];
	}
	else $birthDate.= $_POST[$strDate.'day'];
	return $birthDate;
}
?>